﻿Namespace Backup

    Public Class ReceivedContracts
#Region " Events "
        Public Shared Event Updated(ByVal contract As Entities.Backup.ReceivedContract)
        Public Shared Event UpdatedGUI(ByVal contract As Entities.Backup.ReceivedContract)
        Friend Shared Sub OnUpdated(ByVal contract As Entities.Backup.ReceivedContract)
            RaiseEvent Updated(contract)
            Framework.Threading.Invoke(AddressOf OnUpdated_Callback, contract)
        End Sub
        Private Shared Sub OnUpdated_Callback(ByVal contract As Entities.Backup.ReceivedContract)
            RaiseEvent UpdatedGUI(contract)
        End Sub
#End Region

        Public Shared Function GetAll() As Generic.List(Of Entities.Backup.ReceivedContract)
            Return DataStore.Backup.ReceivedContracts.GetAll
        End Function
        Public Shared Function GetById(ByVal id As Integer) As Entities.Backup.ReceivedContract
            Return DataStore.Backup.ReceivedContracts.GetById(id)
        End Function
        Public Shared Function GetByUniqueId(ByVal uniqueId As String) As Entities.Backup.ReceivedContract
            Return DataStore.Backup.ReceivedContracts.GetByUniqueId(uniqueId)
        End Function

        Public Shared Sub Save(ByVal contract As Entities.Backup.ReceivedContract)
            DataStore.Backup.ReceivedContracts.Save(contract)
            OnUpdated(contract)
        End Sub
    End Class

End Namespace